package net.seehope.foodie.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;


//它在spring容器中是一个bean，用来配置组件的
@Configuration
public class SwaggerConfig {
	
	//所有标记了@Bean的方法在容器初始化的时候都会被调用一次
	//使用java代码进行配置
	@Bean
	public Docket createDocument() {
		return new Docket(DocumentationType.SWAGGER_2).apiInfo(createApiInfo()).select()
				.apis(RequestHandlerSelectors.basePackage("net.seehope")).build();
	}
	
	public ApiInfo createApiInfo() {
		return new ApiInfoBuilder().contact(new Contact("kyun","www.baidu.com","654822751@qq.com"))
				.description("广工车神浩南").title("车神资料").version("0.0.1").termsOfServiceUrl("www.baidu.com").build();
	}

}
